/*
ID:luongho3
LANG:JAVA
TASK:hamming
 */
package usaco.training.chap2.sec1;

import java.io.File;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class hamming {

	static int N, B, D, n;
	static int[] visit;
	static int[] nodes;
	
	public static void main(String[] args) throws Exception {
		Scanner scanner = new Scanner(new File("hamming.in"));
		PrintStream ps = new PrintStream(new File("hamming.out"));
		System.setOut(ps);
		N = scanner.nextInt();
		B = scanner.nextInt();
		D = scanner.nextInt();
		n = 1<<B;
		visit = new int[n];
		nodes = new int[N];
		for (int i=0;i<n;++i) {
			visit[i] = 1;
			nodes[0] = i;
			dfs(1);
			visit[i] = 0;
		}
	}

	private static void dfs(int count) {
		if (count == N) {
			Arrays.sort(nodes);
			for (int i=0;i<count;++i) {
				System.out.print(nodes[i]);
				if (i==count-1) {
					System.out.println();
				}
				else {
					if (i%10==9) {
						System.out.println();
					}
					else {
						System.out.print(" ");
					}
				}
			}
			System.exit(0);
		}
		else {
			for (int i=0;i<n;++i) {
				if (visit[i] != 1) {
					boolean flag = true;
					for (int j=0;j<count;++j) {
						if (dist(i,nodes[j]) < D) {
							flag = false;
							break;
						}
					}
					if (flag) {
						visit[i] = 1;
						nodes[count] = i;
						dfs(count+1);
						visit[i] = 0;
					}
				}
			}
		}
	}

	private static int dist(int a, int b) {
		int c =  a ^ b;
		int count = 0;
		while (c > 0) {
			if (c%2 == 1) {
				++count;
			}
			c /= 2;
		}
		return count;
	}

}
